/**
 * 策略枚举
 */
 public enum  PayrollDay2Enum {
     MONDAY(PayType.WEEKDAY), TUESDAY(PayType.WEEKDAY), WEDNESDAY(PayType.WEEKDAY), THURSDAY(PayType.WEEKDAY), FRIDAY(PayType.WEEKDAY),
    SATURDAY(PayType.WEEKEND), SUNDAY(PayType.WEEKEND);

    private final PayType payType;

    PayrollDay2Enum(PayType payType) {
        this.payType = payType;
    }

    double pay(double hur, double rate) {
        return this.payType.pay(hur, rate);
    }

    private enum PayType {
     WEEKDAY{
         @Override
         double overtimePay(double hoursWorked, double payRate) {
             return hoursWorked < HOURS_FER_SHIFT ? 0 : (hoursWorked - HOURS_FER_SHIFT) * payRate / 2;
         }
     },
     WEEKEND{
         @Override
         double overtimePay(double hoursWorked, double payRate) {
             return hoursWorked * payRate / 2;
         }
     };
        private static final int HOURS_FER_SHIFT = 8;

        abstract double overtimePay(double hoursWorked, double payRate);

        double pay(double hours, double rate) {
            double basePay = hours * rate;
            return basePay + overtimePay(hours, rate);
        }
 }



}
